<template>
  <div class="p-2 bg-white" :style="contentStyle" >
    <!-- 内容列表 -->
    <div>
      <el-tabs v-model="mainActiveName" @tab-click="detailTabs">
        <el-tab-pane label="基本信息" name="1">
           <archivalInfo :providerId="providerId" :disabled="true" ref="archivalInfo"></archivalInfo>
        </el-tab-pane>
        <!-- <el-tab-pane label="体检项" name="2">
          <el-tabs type="border-card"  v-model="physicalExaminationActive" @tab-click="physicalExaminationClick">
            <el-tab-pane label="生命体征" name="1">
              <vitalSigns :bodyRecodeId="bodyRecodeId" :providerId="providerId" :disabled="true" ref="vitalSigns"/>
            </el-tab-pane>
            <el-tab-pane label="脉波压力检测" name="2">
              <stressCase :bodyRecodeId="bodyRecodeId" :providerId="providerId" type="watch"  ref="stressCase"/>
            </el-tab-pane>
            <el-tab-pane label="微循环检测" name="3">
              <microcirculation :bodyRecodeId="bodyRecodeId"  ref="microcirculation" type="watch"></microcirculation>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane> 
        <el-tab-pane label="身体检测" name="3">
          <physicalExamination  :providerId="providerId"  :pid="pid" ref="physicalExamination"></physicalExamination>
        </el-tab-pane>-->
        <el-tab-pane label="外院报告" name="4">
          <el-tabs type="border-card"  v-model="outerCourtActiveName" @tab-click="outerCourtTabsHandler">
            <el-tab-pane label="历史" name="1">
               <historicalCase ref="historicalCase" :idNo="idNo" type="5"></historicalCase>
            </el-tab-pane>
            <el-tab-pane label="血液" name="2">
              <bloodCase ref="bloodCase" :idNo="idNo" type="1"></bloodCase>
            </el-tab-pane>
            <el-tab-pane label="CT检测" name="3">
               <otherCase ref="ct" :idNo="idNo" type="2"></otherCase>
            </el-tab-pane>
             <el-tab-pane label="超声" name="4">
                <otherCase ref="cs" :idNo="idNo" type="3"></otherCase>
            </el-tab-pane>
             <el-tab-pane label="其它" name="5">
               <otherCase ref="other" :idNo="idNo" type="4"></otherCase>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>
        <el-tab-pane label="接诊病历" name="5">
          <casesReceived ref="casesReceived" :pid="pid" :providerId="providerId"/>
        </el-tab-pane>
        <el-tab-pane label="院外检测" name="6">
          <outHospitalExamine ref="outHospitalExamine" :pid="pid" :providerId="providerId" />
        </el-tab-pane>
        <el-tab-pane label="院内血液检测" name="7">
          <bloodExaminationHospital ref="bloodExaminationHospital" :pid="pid" :providerId="providerId" />
        </el-tab-pane>
        <el-tab-pane label="知情同意书" name="8">
          <informedConsent  :hid="pid" :providerId="providerId" ref="informedConsent"></informedConsent>
        </el-tab-pane>
        <el-tab-pane label="治疗方案拟定" name="9">
          <programming :hid="pid" :providerId="providerId"   ref="programming"></programming>
        </el-tab-pane>
        <el-tab-pane label="治疗计划" name="10">
        <treatmentPlan :providerId="providerId" :pid="pid" ref="treatmentPlan"></treatmentPlan>
        </el-tab-pane>
        <el-tab-pane label="临时医嘱" name="11">
        <tempDoctorAdvice :providerId="providerId"  :registerNo="registerNo"  :displayInsert="displayInsert" ref="tempDoctorAdvice"></tempDoctorAdvice>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script>
import api from "plugins/axios/api.js";
import {queryTreatments,calling} from "plugins/axios/inquiryRecord.js"
import {mapState} from 'vuex'

// 基本档案信息
import archivalInfo from "views/operationManage/components/inquiryRecordDetail/archivalInfo.vue";
// 体检项-生命体征
import vitalSigns from 'views/operationManage/components/inquiryRecordDetail/physicalExaminationItems/vitalSigns.vue';
// 体检项-脉波压力检测
import stressCase from 'views/operationManage/components/inquiryRecordDetail/physicalExaminationItems/stressCase.vue';
// 体检项-微循环检测
import microcirculation from 'views/operationManage/components/inquiryRecordDetail/physicalExaminationItems/microcirculation.vue';
// 身体检测
import physicalExamination from 'views/operationManage/components/inquiryRecordDetail/physicalExamination.vue';
// 外院报告-历史
import historicalCase from 'views/operationManage/components/inquiryRecordDetail/externalHospitalReport/historicalCase.vue';
// 外院报告-血液
import bloodCase from 'views/operationManage/components/inquiryRecordDetail/externalHospitalReport/bloodCase.vue';

// 外院报告- ct(2) 超声（3）其他（4）
import otherCase from 'views/operationManage/components/inquiryRecordDetail/externalHospitalReport/otherCase.vue';
// 接诊病历
import casesReceived from 'views/operationManage/components/inquiryRecordDetail/casesReceived/casesReceived.vue';
// 院外检测
import outHospitalExamine from 'views/operationManage/components/inquiryRecordDetail/outHospitalExamine.vue';
// 院内血液检查
import bloodExaminationHospital from 'views/operationManage/components/inquiryRecordDetail/bloodExaminationHospital.vue';
// 知情同意书
import informedConsent from 'views/operationManage/components/interrogation/InformedConsent.vue';
// 方案拟定
import programming from 'views/operationManage/components/inquiryRecordDetail/programming.vue';
// 治疗计划
import treatmentPlan from 'views/operationManage/components/inquiryRecordDetail/treatmentPlan/treatmentPlan.vue';
/* 临时医嘱 */
import tempDoctorAdvice from 'views/operationManage/components/inquiryRecordDetail/tempDoctorAdvice.vue';

export default {
  components: {
    archivalInfo,
    vitalSigns,
    stressCase,
    microcirculation,
    physicalExamination,
    historicalCase,
    bloodCase,
    otherCase,
    casesReceived,
    outHospitalExamine,
    bloodExaminationHospital,
    informedConsent,
    programming,
    treatmentPlan,
    tempDoctorAdvice
  },
  
  data() {
    return {
      mainActiveName:'1',
      // 体检项选中
      physicalExaminationActive:'1',
      // 外院报告选中
      outerCourtActiveName:'1',
      providerId:'',
      pid:'',
      bodyRecodeId:'',
      idNo:'',//身份证号码
      registerNo:'',
      displayInsert:'1'
    };
  },
  computed: {
    ...mapState({
      clientHeight:state=>state.common.clientHeight
    }),
    contentStyle() {
      return {
        height:this.clientHeight+'px',
      }
    }
  },
  created() {
    this.providerId=this.$route.query.providerId;
    this.pid = this.$route.query.id
    this.bodyRecodeId=this.$route.query.bodyRecodeId
    this.idNo=this.$route.query.idNo
    this.registerNo=this.$route.query.registerNo
  },
  mounted() {},
  methods: {
    syschRecodeStatus(){

    },
    detailTabs(ins) {
      let self = this;
      switch (self.mainActiveName) {
        case "1":
          break;
        case "2":
           // 获取体检项-生命体征
          self.physicalExaminationActive='1';
          self.$refs.vitalSigns.init();
          break;
          // 身体检测
        case "3":
          self.$refs.physicalExamination.init();
          break;
        case "4":
         // 获取外院报告-历史
          self.outerCourtActiveName='1';
          self.$refs.historicalCase.init();
          break; 
        case "5":
          self.$refs.casesReceived.init();
          break; 
        case "6":
          self.$refs.outHospitalExamine.init();
          break;
        case "7":
          self.$refs.bloodExaminationHospital.init();
          break; 
        case "8":
          //  self.cValZqtys = Math.random(10000);
           self.$refs.informedConsent.init();
          break;
         case "9":
          //  self.cValPlan= Math.random(10000);
           self.$refs.programming.init();
           
          break;
         case "10":
          self.$refs.treatmentPlan.init(new Date());
          break;
         case "11":
          self.$refs.tempDoctorAdvice.init();
          break;
        default:
          break;
      }
    },
    // 体检项点击Tab
    physicalExaminationClick(){
      let self = this;
      switch (self.physicalExaminationActive) {
        case '1':
          self.$refs.vitalSigns.init();
          break; 
        case '2':
          self.$refs.stressCase.init();
          break; 
        case '3':
        self.$refs.microcirculation.init();
          break;
        default:
          break;
      }
    },
    // 外院报告点击Tab
    outerCourtTabsHandler(){
      let self = this;
      switch (self.outerCourtActiveName) {
        case '1':
          self.$refs.historicalCase.init();
          break; 
        case '2':
          self.$refs.bloodCase.init();
          break; 
        case '3':
          self.$refs.ct.init();
          break;
        case '4':
          self.$refs.cs.init();
          break;
        case '5':
          self.$refs.other.init();
          break;
        default:
          break;
      }
      
    }    
  }
};
</script>
<style lang="stylus" scoped>
</style>